<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateExamPaperTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('exam_paper', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('app_id')->default(0)->comment('站点标识');
            $table->unsignedBigInteger('room_id')->default(0)->comment('考场标识');
            $table->unsignedBigInteger('user_id')->default(0)->comment('用户标识');
            $table->string('name', 32)->default('')->comment('名称标识');
            $table->json('content')->comment('内容标识');
            $table->json('answer')->comment('答题标识');
            $table->json('review')->comment('阅卷标识');
            $table->unsignedBigInteger('score')->default(0)->comment('试卷得分');
            // 状态
            $table->tinyInteger('status', false, true)->default(1)->comment('状态,1|正常、2|禁用');
            // 创建时间
            $table->dateTimeTz('created_at')->nullable()->comment('创建时间');
            // 更新时间
            $table->dateTimeTz('updated_at')->nullable()->comment('更新时间');
            // 删除时间
            $table->dateTimeTz('deleted_at')->nullable()->comment('删除时间');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('exam_paper');
    }
}
